package com.jkergo.redis.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @GetMapping("/sentinel")
    public String testSentinel() {
        String val = null;
        try {
            val = stringRedisTemplate.opsForValue().get("JK0");
            System.out.println(val);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return val;
    }
}
